package com.eedi.framework.errorcode.enums;

import com.eedi.framework.common.core.IntArrayValuable;
import com.eedi.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;

/**
 * 错误码的类型枚举
 *
 * @author dylan
 */
@AllArgsConstructor
@Getter
@ToString
public enum SysErrorCodeTypeEnum implements BaseEnum<Integer,String>, IntArrayValuable {

    /**
     * 自动生成
     */
    AUTO_GENERATION(1,"自动生成"),
    /**
     * 手动编辑
     */
    MANUAL_OPERATION(2,"手动编辑");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SysErrorCodeTypeEnum::getType).toArray();

    /**
     * 类型
     */
    private final Integer type;
    /**
     * 描述
     */
    private final String desc;


    @Override
    public Integer getCode() {
        return this.type;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    @Override
    public String title() {
        return "错误码的类型";
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
